package com.cloudptt.api.product.func.media.device;

import com.cloudptt.api.product.log.Log;


public class DeviceKeyInfo {

	private static IDeviceKey dev = null;
	
	public static IDeviceKey getInfo()
	{
		if(dev == null)
		{
			dev = newDev();
		}
		return dev;
	}


	private static IDeviceKey newDev()
	{
		String brand = android.os.Build.BRAND.trim();
		String device = android.os.Build.DEVICE.trim();
		String model = android.os.Build.MODEL.trim();
		Log.d("DeviceInfo", "BRAND = " + brand + " DEVICE = " + device  + " MODEL = " + model);
		if(brand == null
				|| device == null
				|| model == null)
		{
			Log.debug(DeviceKeyInfo.class, "DefaultDev");
			return new DefaultDevKey();
		}
		else if(H200P.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "H200P");
			return new H200P();
		}
		else if(PNC370.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "PNC370");
			return new PNC370();
		}
		else if(PDC550.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "PDC550");
			return new PDC550();
		}
		else if(PNC560.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "PNC560");
			return new PNC560();
		}
		else if(PDC680.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "PDC680");
			return new PDC680();
		}
		else if(PDC6802.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "PDC6802");
			return new PDC6802();
		}
		else if(WaterproofA3.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "WaterproofA3");
			return new WaterproofA3();
		}
		else if(NtF3.isThisDev(brand,device,model))
		{
			Log.debug(DeviceKeyInfo.class, "NtF3");
			return new NtF3();
		}
//		else if(H2.isThisDev(brand,device,model))
//		{
//			Log.debug(DeviceKeyInfo.class, "H2");
//			return new H2();
//		}
//		else if(F2.isThisDev(brand,device,model))
//		{
//			Log.debug(DeviceKeyInfo.class, "F2");
//			return new F2();
//		}
		else
		{
			Log.debug(DeviceKeyInfo.class, "DefaultDev");
			return new DefaultDevKey();
		}
	}
	
	public static String getDevStr()
	{
		String brand = android.os.Build.BRAND;
		String device = android.os.Build.DEVICE;
		String model = android.os.Build.MODEL;

		StringBuffer strBuf = new StringBuffer("DevStr  ");
		strBuf.append("BRAND = ").append(brand).append(" ");
		strBuf.append("DEVICE = ").append(device).append(" ");
		strBuf.append("MODEL = ").append(model).append(" ");
		
		return strBuf.toString();
	}
}
